#ifndef __COMMON_H_
#define __COMMON_H_
#include "macros.h"
#include <avr/pgmspace.h>
extern uint8 u4094_port[];
extern uint16 ir_send_count;
PGM_P cstr(PGM_VOID_P addr);
unsigned int cword(PGM_VOID_P addr);
unsigned char cbyte(PGM_VOID_P addr);
double CtrlCodeToCurrent(uint16 value);
void delay_us(uint16 us);
void delay_ms(uint16 ms);
void select_sort(uint16 *a,uint8 N);
int get_sub(uint16 a,uint16 b);
void get_adc(uint16 *ad_arr);

void set_io(uint8 ch);
void set_work_mode(uint8 mode);
void set_drive_dir(uint8 mode);
void set_power(uint8 mode);
void set_phase_a(uint8 state);
void set_phase_c(uint8 state);
void set_phase_loss(uint8 state);
void set_ad_din(uint8 state);
void set_ad_cs(uint8 state);
void set_ad_clk(uint8 state);
void set_u4094_en(uint8 state);
void set_u4094_clk(uint8 state);
void set_local_open(uint8 state);
void set_local_close(uint8 state);
void set_temperature(uint8 state);
void set_remote_open(uint8 state);
void set_remote_close(uint8 state);
void set_remote_hold(uint8 state);
void set_esd(uint8 state);
void set_tq_tc(uint8 state);
void set_tc_over(uint8 state);
void set_tq_open(uint8 state);
void set_tq_close(uint8 state);
void set_limit_open(uint8 state);
void set_limit_close(uint8 state);
void set_remote_auto(uint8 state);
void test_ictrl(void);
void test_ifeedex(void);
void test_ifeed(void);
void test_led(void);
void test_act(void);
void test_4094(void);
void test_4051(void);
void printer(uint8 x,uint8 y,uint16 dt);
void ir_send(uint16 key);
void test_ir_send(void);
#endif 
